package com.superman.supermarket.client.view.commentlist;

import java.util.List;
import java.util.Map;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Widget;
import com.superman.mvpframe.client.mvp.IPageViewPresenter;
import com.superman.mvpframe.client.widget.pulltorefresh.IPullToRefreshView;
import com.superman.mvpframe.client.widget.pulltorefresh.PullToRefreshViewAbstractImpl;
import com.superman.supermarket.client.composite.commentlist.CommentListCellModule;

/**
 * 商品评论列表ui实现类
 * 
 * @author superman
 * @version 2018年8月18日下午5:10:55
 */
public class CommentListViewImpl extends PullToRefreshViewAbstractImpl implements CommentListView {

	interface CommentListViewImplUiBinder extends UiBinder<Widget, CommentListViewImpl> {
	}

	private static CommentListViewImplUiBinder uiBinder = GWT.create(CommentListViewImplUiBinder.class);

	@UiField
	FlowPanel wrapperpanel, commentlistpanel;

	/**
	 * 构造方法
	 * 
	 * @author superman
	 * @version 2018年8月18日 下午5:10:53
	 */
	public CommentListViewImpl() {
		initWidget(uiBinder.createAndBindUi(this));
	}

	@Override
	public IPullToRefreshView getPullToRefreshView() {
		return this;
	}

	@Override
	public void init() {
		// TODO Auto-generated method stub

	}

	@Override
	public void setDataListDivId(String id) {
		commentlistpanel.getElement().setId(id);
	}

	@Override
	public void setListData(List<Map<String, Object>> list) {
		for (Map<String, Object> map : list) {
			CommentListCellModule commentListCellModule = new CommentListCellModule();
			commentListCellModule.setData(map);
			this.commentlistpanel.add(commentListCellModule);
		}
	}

	@Override
	public void setMeScrollDivId(String id) {
		wrapperpanel.getElement().setId(id);
	}

	@Override
	public void setPageViewPresenter(IPageViewPresenter presenter) {
		// TODO Auto-generated method stub

	}

}
